<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
    <script src="./angular.js"></script>
    <script src="../jquery1.9.1.min.js"></script>
    <script>
        let mod = angular.module('mod1', [] );
        mod.controller('ctrl1', function($scope, $interval) {
            $scope.arr = [
                {name: "tim", mobile: 18754236981},
                {name: "jack", mobile: 15549781658},
                {name: "tom", mobile: 13963589764},
            ]
        });
        // filter方法自定义过滤器，第一个参数是过滤器名称，第二个是回调函数。
        mod.filter('a', function() {
            // return 的函数才是filter真正的函数
            // 参数1：输入的值，也就是数据未经过滤的值。参数2：给过滤器传的值
            return function (input, arg) {
                input = input.toString();
                return input.substring(0,3) + '****' + input.substring(7)
            }
        });
    </script>
    <body ng-app="mod1">
        <div ng-controller="ctrl1">
            <ul>
                <li ng-repeat="json in arr track by $index">
                    {{json.name}}, {{json.mobile|a}}
                </li>
            </ul>
        </div>
    </body>
</html>